<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>存定期</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/jiazai.css">
    <style>
        .hea-con {
            padding: 10px 20px 0;
            font-size: 16px;
            color: white;
            opacity: .7;
        }
        
        .logo {
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        }
        
        .logo>span:first-of-type {
            padding-top: 10px;
            font-size: 20px;
            color: white;
        }
        
        .logo>span:last-of-type {
            padding-top: 10px;
            font-size: 14px;
            color: #9197ae;
        }
        
        .update {
            margin-top: 40px;
            padding: 20px;
            font-size: 16px;
            color: white;
            border-bottom: 1px solid rgba(20, 20, 20, .2);
        }
    </style>
</head>

<body style="background:#2a2c35;">
    <div id='app'>


        <!-- 加载中动画 -->
        <div id='jiazai-ani' v-if='jiazai'>
            <div class="arc"></div>
            <h1><span>LOADING</span></h1>
        </div>
        <!-- 加载中动画 -->

        <div class='hea-con dis-spa'>
            <img @click='_close()' src="./img/left.svg" width="22px" height="22px">
            <span>
                检查更新
            </span>
            <span style="opacity:0">1</span>
        </div>

        <div style="padding-top:30px;">
            <div class='logo'>
                <img src="./img/logo.png" width="100px" height="100px">
                <span>Coindapp</span>
                <span>版本号：{{banben}}</span>
            </div>
            <div class='dis-spa update' @click='update'>
                <span>检查更新</span>
                <img src="./img/right.svg" width="15px" height="15px">
            </div>
        </div>

    </div>
    <script src="js/comm.js"></script>
    <script src="js/vue.min.js"></script>
    <script src="js/update.js"></script>
    <script src="js/jquery.min.js"></script>
    <script>
        var app = new Vue({
            el: '#app',
            data: {
                jiazai: false,
                banben: ''
            },
            methods: {
                update: function() {
                    this.jiazai = true;
                    var This = this;
                    plus.runtime.getProperty(plus.runtime.appid, function(info) {
                        _post(UPDATA, {
                            var: info.version
                        }, function(item) {
                            This.jiazai = false;
                            if (item.status == 1) {
                                var buttons = ["更新"];
                                plus.nativeUI.confirm(item.back.msg, function(ev) {
                                    if (ev.index == 0) {
                                        install(item.back);
                                    }
                                }, "发现新版,是否立即更新", buttons);
                            } else {
                                _toast('已经是最新版本');
                            }
                        });
                    });
                }
            }
        });
    </script>
    <script type="text/javascript" charset="utf-8">
        function plusReady() {
            plus.runtime.getProperty(plus.runtime.appid, function(info) {
                app.$data.banben = info.version;
            });
        }

        // 判断扩展API是否准备，否则监听'plusready'事件
        if (window.plus) {
            plusReady();
        } else {
            document.addEventListener('plusready', plusReady, false);
        }
    </script>
</body>

</html>